package com.itheima.demo;

import com.itheima.domain.Item;
import com.itheima.domain.Order;
import com.itheima.domain.User;
import com.itheima.mapper.OrderMapper;
import com.itheima.mapper.UserMapper;
import com.itheima.utils.MapperUtil;

import java.util.List;

public class Demo {
    public static void main(String[] args) {
        OrderMapper mapper = MapperUtil.getMapper(OrderMapper.class);
        List<Order> list = mapper.findAll();
        for (Order order : list) {
            System.out.println("订单编号: " + order.getNumber());
            List<Item> itemList = order.getItemList();
            User user = order.getUser();
            System.out.println("客户姓名: " + user.getName());
            for (Item item : itemList) {
                System.out.println("商品名称: " + item.getName());
            }
        }
    }
}
